<?php
namespace iBrand\Shop\Core\Repositories;

use Prettus\Repository\Eloquent\BaseRepository;
use iBrand\Shop\Core\Models\ClerkBalanceOrder;

class ClerkBalanceOrderRepository extends BaseRepository
{
    public function model()
    {
        return ClerkBalanceOrder::class;
    }


    public function getClerkBalanceOrderByUserId($user_id,$shop_id,$limit=15){
        return $this->model->where('shop_id',$shop_id)
            ->with('balanceOrder')
            ->with('clerk')
            ->with('shops.city')
            ->whereHas('balanceOrder', function ($query) use($user_id) {
                return $query->where('user_id', $user_id)->where('pay_status',1);
            })->orderBy('created_at','desc')->paginate($limit);
    }


   

}